package cn.wang.web;

import cn.wang.utils.Pagination;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;

import java.util.List;
import java.util.Map;


//通过RequestAware, SessionAware, ApplicationAware实行接口获得request,session,application对象，action中就可直接调用

public abstract class PageAction extends BaseAction {
    private static Logger log = Logger.getLogger(PageAction.class);

    protected void push(Object value) {
        ActionContext.getContext().getValueStack().push(value);
    }

    protected Pagination page = new Pagination();
    protected final String LIST = "list";
    protected final String TOVIEW = "toview";
    protected final String TOCREATE = "tocreate";
    protected final String TOUPDATE = "toupdate";

    public abstract String list();

    public abstract String toview();

    public abstract String tocreate();

    public abstract String toupdate();

    public abstract String insert();

    protected void put(String key, Object value) {
        ActionContext.getContext().put(key, value);
    }


    public void setPage(Pagination page) {
        this.page = page;
    }
}
